UV_TCP_IPV6ONLY : 0);
rc = uv_listen(
- (uv_stream_t*) &backend_server,
+ (uv_stream_t *) &backend_server,
DEFAULT_BACKLOG,
on_new_connection);
buffer[len] = '\0';
return buffer;
-
}
+/*
+ * Cleanup socket (pipe) file.
+ */
void sirinet_pipe_unlink(uv_pipe_t * client)
{
char * pipe_name = sirinet_pipe_name(client);
sirinet_stream_decref(client); \
return;
-
/*
* Returns NULL and raises a SIGNAL in case an error has occurred.
*
*/
sirinet_stream_t * sirinet_stream_new(sirinet_stream_tp_t tp, on_data_cb_t cb)
{
+ size_t stream_sz;
sirinet_stream_t * client = malloc(sizeof(sirinet_stream_t));
if (client == NULL)
client->siridb = NULL;
client->ref = 1;
- size_t stream_sz = (tp == STREAM_PIPE_CLIENT)
- ? sizeof(uv_pipe_t)
- : sizeof(uv_tcp_t);
+ switch(tp)
+ {
+ case STREAM_TCP_CLIENT:
+ case STREAM_TCP_BACKEND:
+ case STREAM_TCP_SERVER:
+ case STREAM_TCP_MANAGE:
+ stream_sz = sizeof(uv_tcp_t);
+ break;
+ case STREAM_PIPE_CLIENT:
+ stream_sz = sizeof(uv_pipe_t);
+ break;
+ default:
+ stream_sz = sizeof(uv_stream_t);
+ assert(0);
+ }
client->stream = malloc(stream_sz);
if (client->stream == NULL)
return NULL;
}
-
/*
* This function can raise a SIGNAL.
*/
}
}
-
-
/*
* Never use this function but call sirinet_stream_decref.
* Destroy stream. (parsing NULL is not allowed)
from test_user import TestUser
from test_compression import TestCompression
from test_log import TestLog
+from test_log import TestLog
+from test_pipe_support import TestPipeSupport
Server.BUILDTYPE = 'Release'
run_test(TestServer())
run_test(TestUser())
run_test(TestLog())
+ run_test(TestPipeSupport())
await pipe_client.connect('iris', 'siri', self.db.dbname)
- await pipe_client.insert(DATA)
+ self.assertEqual(
+ await pipe_client.insert(DATA),
+ {'success_msg': 'Successfully inserted 10 point(s).'})
+
+ self.assertAlmostEqual(
+ await pipe_client.query('select * from "series num_float"'),
+ {'series num_float': DATA['series num_float']})
+
+ self.assertEqual(
+ await pipe_client.query('select * from "series num_integer"'),
+ {'series num_integer': DATA['series num_integer']})
self.assertEqual(
await pipe_client.query('select * from "series_log"'),
pipe_client.close()
-
# return False